package org.djw.system.service.impl;

import org.djw.basic.service.impl.BaseServiceImpl;
import org.djw.basic.util.PageList;
import org.djw.system.domain.Detail;
import org.djw.system.domain.Type;
import org.djw.system.mapper.DetailMapper;
import org.djw.system.mapper.TypeMapper;
import org.djw.system.query.TypeQuery;
import org.djw.system.service.ITypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class TypeServiceImpl extends BaseServiceImpl<Type> implements ITypeService{
    @Autowired
    private TypeMapper typeMapper;
    @Autowired
    private DetailMapper detailMapper;

    @Override
    public void remove(Long id) {
        //先删除类型下的明细
        detailMapper.deleteBytypeId(id);
        //再删除类型
        typeMapper.delete(id);
    }

}
